<template>
  <div class="login">
    <h2>农业大棚可视化系统登录</h2>
    <form @submit.prevent="login">
      <div>
        <label for="email">邮箱：</label>
        <input type="email" id="email" v-model="email" placeholder="请输入邮箱" required />
      </div>
      <div>
        <label for="password">密码：</label>
        <input type="password" id="password" v-model="password" placeholder="请输入密码" required />
      </div>
      <button type="submit">登录</button>
    </form>
    <p>
      还没有账号? <router-link to="/register">点击注册</router-link>
    </p>
  </div>
</template>

<script>
  export default {
  data() {
  return {
  email: '',
  password: '',
};
},
  methods: {
  login() {
  // 模拟登录逻辑
  console.log('Login with:', this.email, this.password);
  // 跳转到大屏页面
  this.$router.push('/dashboard');
},
},
};
</script>

<style scoped>
.login {
  animation: fadeIn 0.5s ease-in-out;
  max-width: 400px;
  padding: 50px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h2 {
  text-align: center;
  margin-bottom: 20px;
  color: #2575fc;
}

form {
  display: flex;
  flex-direction: column;
}

label {
  margin-bottom: 5px;
  font-weight: bold;
}

input {
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 16px;
}

button {
  padding: 10px;
  background: #2575fc;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease;
}

button:hover {
  background: #1a5bbf;
}

p {
  text-align: center;
  margin-top: 15px;
}

a {
  color: #2575fc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}
/* 添加按钮点击效果 */
button:active {
  transform: scale(0.98);
}

/* 添加输入框聚焦效果 */
input:focus {
  border-color: #2575fc;
  outline: none;
  box-shadow: 0 0 5px rgba(37, 117, 252, 0.5);
}
</style>
